define(function(require, exports, module) {

  var Backbone = require('backbone');
  var $ = require('jquery');
  var _ = require('underscore');
  var jsonview = require('jsonview');
  var tmpl = require('text!../tmpl.html');

  function inherits(clazz, baseClazz) {
    var clazzPrototype = clazz.prototype;
    function F() {}
    F.prototype = baseClazz.prototype;
    clazz.prototype = new F();

    for (var param in clazzPrototype) {
      clazz.prototype[param] = clazzPrototype[param];
    }

    clazz.prototype.constructor = clazz;
    clazz.superClass = baseClazz
  }

  function Animal() {
    console.log('1:Animal constructor')
    this.runSpeed = '1'
  }

  Animal.prototype.run = function() {
    console.log('It is running in', this.runSpeed, 'speed')
  }

  //圆口纲、软骨鱼纲、硬骨鱼纲、两栖纲、爬行纲、鸟纲和哺乳纲

  function Mammal() {
    Animal.apply(this, arguments)
    console.log('2:Mammal constructor')
    this.suckleChild = '1'
  }

  Mammal.prototype.suckle = function() {
    console.log('It is suckling', this.suckleChild, 'child')
  }

  inherits(Mammal, Animal)

  class Bird extends Animal {
    constructor() {
      super()
      console.log('2:Bird constructor')
    }
  }

  function Cat() {
    console.log('3:Cat constructor')
  }

  function Cat1() {
    Mammal.apply(this, arguments)
    Cat.apply(this, arguments)
  }
  
  inherits(Cat1, Mammal)
  inherits(Cat1, Cat)


  class Dog {
    constructor() {
      console.log('3:Dog constructor')
    }
  }

  class Swallow {
    constructor() {
      console.log('3:Swallow constructor')
    }
  }


  function main() {

    var cat = new Cat1()
    cat.suckle()
    cat.run()
    // var dog = new Dog()
    // var swallow = new Swallow()

    var $app = $('<div id="app">');
    $('#main').html($app);

    $app.append(tmpl);
  }

  return main;
})
